package cn.wfu.rlrjds.web.admin.dao.ipml;

import java.util.LinkedHashSet;
import java.util.List;
import java.util.Set;

import org.springframework.stereotype.Repository;

import cn.wfu.rlrjds.common.dao.impl.MybatisDaoImpl;
import cn.wfu.rlrjds.web.admin.dao.IAdminDao;
import cn.wfu.rlrjds.web.admin.domain.Admin;

@Repository(value = "adminDao")
public class AdminDaoIpml extends MybatisDaoImpl<Admin, Integer> implements
		IAdminDao {

	@Override
	public Set<String> getRoles(String userName) {
		// TODO Auto-generated method stub
		List<String> roles = this.getSqlSession().selectList(
				IAdminDao.NAME_SPACE + SQL_GETROLES, userName);
		return new LinkedHashSet<String>(roles);
	}

	@Override
	public Set<String> getPermissions(String userName) {
		// TODO Auto-generated method stub
		List<String> permissions = this.getSqlSession().selectList(
				IAdminDao.NAME_SPACE + SQL_GETPERMISSIONS, userName);
		return new LinkedHashSet<String>(permissions);
	}

}
